package com.xk.school_device.mapper;

import com.xk.school_device.entity.Purchases;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xk
 * @since 2025-04-16
 */
@Mapper
public interface PurchasesMapper extends BaseMapper<Purchases> {

    List<Purchases> getPurchases(Purchases purchases);

    @Delete("delete from purchases where purchase_id = #{id}")
    void deletePurchase(String id);

    void updatePurchasesById(Purchases purchases);

    // 查询待审批的采购记录
    List<Purchases> findPendingApprovals(Purchases purchases);

    @Select("select * from purchases where purchase_id = #{purchaseId}")
    Purchases getPurchaseById(String purchaseId);
}
